#ifndef TYPE_FACTORY_H
#define TYPE_FACTORY_H

#include "../types/type.h"

#include <QtCore/QHash>
#include <QtCore/QSet>

namespace core
{

class TypeFactory
{
public:
    static TypeFactory* getInstance();
    static void destroy();

    void registerType(const Type& type);
    void unregisterType(const TypeName& name);

    const Type* getTypeInstance(const TypeName& name);

    bool isRegistered(const Type& type);
    QSet<TypeName> registeredTypes() const;
    QSet<ValueKeywordMask> registeredKeywordMasks() const;

private:
    TypeFactory();
    ~TypeFactory();

private:
    QHash<TypeName, const Type* > m_registeredTypes;
    QSet<ValueKeywordMask> m_registeredKeywordMasks;
};

} // namespace core

#endif
